<h1>Aktivasi Member (Kloning)</h1>
<?php if ($show): ?>
    <?php $form  =  $this->beginWidget('CActiveForm'); ?>
    <?php echo $form->hiddenField($model, 'password'); ?>
    <?php echo $form->hiddenField($model, 'password2'); ?>
    <?php echo $form->hiddenField($model, 'fix', array('value' => 'active')); ?>
    <div class="add">
        <table cellpadding="0" cellspacing="0" border="0">
            <tr class="title">
                <th colspan="2" style="text-align:left;"><strong>DATA JARINGAN</strong></th>
            </tr>
            <tr valign="top">
                <th width="110">Sponsor ID</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_sponsor; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_sponsor'); ?>
                    <?php echo $form->error($model, 'member_sponsor', array('style' => 'color:#d00; display:inline; padding-left:5px;')); ?><div id="tempat"></div>
                </td>
            </tr>
            <tr>
                <th valign="top">Upline ID</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_upline; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_upline'); ?>
                    <?php echo $form->error($model, 'member_upline', array('style' => 'color:#d00; display:inline; padding-left:5px;')); ?><div id="tempat1"></div>
                </td>
            </tr>
            <tr>
                <th valign="top">Posisi</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo ($model->position == 'L') ? 'Kiri' : 'Kanan'; ?></strong>
                    <?php echo $form->hiddenField($model, 'position'); ?>
                    <?php echo $form->error($model, 'position', array('style' => 'color:#d00; display:inline; padding-left:5px;')); ?>
                </td>
            </tr>
            <tr class="title">
                <th colspan="2" style="text-align:left;"><strong>DATA KARTU</strong></th>
            </tr>
            <tr>
                <th valign="top">Serial Number <font color="#dd0000" size="4">*</font></th>
                <td><?php echo $form->textField($model, 'serial_id', array('size' => '15', 'class' => 'text')); ?><?php echo $form->error($model, 'serial_id', array('style' => 'color:#d00; display:inline; padding-left:5px;')); ?></td>
            </tr>
            <tr>
                <th valign="top">PIN <font color="#dd0000" size="4">*</font></th>
                <td><?php echo $form->passwordField($model, 'serial_pin', array('size' => '15', 'class' => 'text')); ?><?php echo $form->error($model, 'serial_pin', array('style' => 'color:#d00; display:inline; padding-left:5px;')); ?></td>
            </tr>
            <tr class="title">
                <th colspan="2" style="text-align:left;"><strong>DATA PRIBADI</strong></th>
            </tr>
            <tr>
                <th valign="top">Nama Lengkap</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_name; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_name'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Nama Alias <font color="#dd0000" size="4">*</font></th>
                <td style="vertical-align:middle;">
                    <?php echo $form->textField($model, 'member_nickname', array('size' => '30', 'class' => 'text')); ?>
                    <?php echo $form->error($model, 'member_nickname', array('style' => 'color:#d00; display:inline; padding-left:5px;')); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">E-mail</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_email; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_email'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Alamat</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_address; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_address'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Propinsi</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo function_lib::get_area_name($model->member_state_id); ?></strong>
                    <?php echo $form->hiddenField($model, 'member_state_id'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Kota / Kabupaten</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo function_lib::get_area_name($model->member_city_id); ?></strong>
                    <?php echo $form->hiddenField($model, 'member_city_id'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Kode Pos</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_zipcode; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_zipcode'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Tempat Lahir</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_birth_place; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_birth_place'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Tanggal Lahir</th>
                <td style="vertical-align:middle;">
                    <?php
                    if($model->member_birth_date != '0000-00-00') {
                        $member_birth_date = function_lib::convert_date($model->member_birth_date, 'text', '', 'ina');
                    } else {
                        $member_birth_date = '-';
                    }
                    ?>
                    <strong><?php echo $member_birth_date; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_birth_date'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Jenis Kelamin</th>
                <td style="vertical-align:middle;">
                    <?php
                    if ($model->member_sex != '') {
                        $member_sex = ($model->member_sex == 'male') ? 'Laki-laki' : 'Perempuan';
                    }
                    ?>
                    <strong><?php echo $member_sex; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_sex'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">No. Identitas</th>
                <td style="vertical-align:middle;">
                    <?php
                    switch ($model->member_identity_type) {
                        case "ktp":
                            $member_identity_type = 'KTP';
                            break;

                        case "sim":
                            $member_identity_type = 'SIM';
                            break;

                        case "passport":
                            $member_identity_type = 'Passport';
                            break;

                        default:
                            $member_identity_type = '';
                            break;
                    }
                    ?>
                    <strong><?php echo '(' . $member_identity_type . ') ' . $model->member_identity_no; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_identity_no'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">No. Telepon</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_phone; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_phone'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">No. Handphone</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_mobilephone; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_mobilephone'); ?>
                </td>
            </tr>
            <tr class="title">
                <th colspan="2" style="text-align:left;"><strong>DATA PEWARIS</strong></th>
            </tr>
            <tr>
                <th valign="top">Nama</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_devisor_name; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_devisor_name'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Hubungan</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_devisor_relationship; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_devisor_relationship'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">No. Telepon</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_devisor_phone; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_devisor_phone'); ?>
                </td>
            </tr>
            <tr class="title">
                <th colspan="2" style="text-align:left;"><strong>DATA BANK</strong></th>
            </tr>
            <tr>
                <th valign="top">Nama Bank</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo function_lib::get_bank_name($model->member_bank_id); ?></strong>
                    <?php echo $form->hiddenField($model, 'member_bank_id'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Kota Bank</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_bank_city; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_bank_city'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Cabang</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_bank_branch; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_bank_branch'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Nama Nasabah</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_bank_account_name; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_bank_account_name'); ?>
                </td>
            </tr>
            <tr>
                <th valign="top">Nomor Rekening</th>
                <td style="vertical-align:middle;">
                    <strong><?php echo $model->member_bank_account_no; ?></strong>
                    <?php echo $form->hiddenField($model, 'member_bank_account_no'); ?>
                </td>
            </tr>
            <tr>
                <th>&nbsp;</th>
                <td>
                    <?php
                    $str_javascript = "var pos = get_checkbox();if(confirm('Sponsor anda: '+document.getElementById('" . CHtml::activeId($model, 'member_sponsor') . "').value+' \\r\\nUpline anda: '+document.getElementById('" . CHtml::activeId($model, 'member_upline') . "').value+'\\r\\nPosisi Node anda: '+pos+'\\r\\n\\r\\nApakah Anda yakin akan data tersebut ?')) return true; else return false;";
                    echo CHtml::submitButton('Register', array("onclick" => $str_javascript, 'encode' => false, "class" => "button"));
                    ?>
                </td>
            </tr>
        </table>
    </div>
    <script>
        function get_checkbox() {
            var pos = document.getElementsByName('registrasi_form[position]');
            var length = pos.length;
            for(var i = 0; i < length; i++) {
                if(pos[i].checked) {
                    var position = pos[i].value;
                }
            }
            return (position == 'R') ? 'kanan' : 'kiri';
        }  
    </script>
    <br /> 
    <?php $this->endWidget(); ?>
<?php else: ?>
    <?php echo $message; ?>
<?php endif; ?>